#include "include/colorspace.h"
#include <iostream>

using namespace std;

void ColorSpaceDemo::colorSpaceConvert(cv::Mat& img)
{

    //BGR通道的范围是三个都是0-255
    //HSV通道的范围是H:0-179,S:0-255,V:0-255
    cv::Mat img_hsv, img_lab, img_ycrcb;
    cv::cvtColor(img, img_hsv, cv::COLOR_BGR2HSV);
    cv::cvtColor(img, img_lab, cv::COLOR_BGR2Lab);
    cv::cvtColor(img, img_ycrcb, cv::COLOR_BGR2YCrCb);

    namedWindow("ColorSpaceDemo1", cv::WINDOW_AUTOSIZE);
    imshow("ColorSpaceDemo1", img_ycrcb);

    namedWindow("ColorSpaceDemo2", cv::WINDOW_AUTOSIZE);
    imshow("ColorSpaceDemo2", img_hsv);

    namedWindow("ColorSpaceDemo3", cv::WINDOW_AUTOSIZE);
    imshow("ColorSpaceDemo3", img_lab);

    waitKey(0);
    destroyAllWindows();
}